﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NeuralNetwork
{
    class Program
    {
        static void Main(string[] args)
        {
            var nn = new NeuralNetworkTeacher(2, 1, new int[] { 5 }, 0.6, 0.7);

            nn.AddInputTargetPair(new double[] { 0.0, 0.0 },
                new double[] { 0.0 });
            nn.AddInputTargetPair(new double[] { 0.0, 1.0 },
                new double[] { 1.0 });
            nn.AddInputTargetPair(new double[] { 1.0, 0.0 },
                new double[] { 1.0 });
            nn.AddInputTargetPair(new double[] { 1.0, 1.0 },
                new double[] { 0.0 });
            nn.Train();


            Console.WriteLine("-------------------------------");
            nn.SimulateWith(new double[] { 0, 0 });

            Console.WriteLine("Outputs: ");
            foreach (var result in nn.Outputs)
            {
                Console.WriteLine(result);
            }
            Console.WriteLine("Actual: 0");

            nn.SimulateWith(new double[] { 0, 1 });
            Console.WriteLine("Outputs: ");
            foreach (var result in nn.Outputs)
            {
                Console.WriteLine(result);
            }
            Console.WriteLine("Actual: 1");

            nn.SimulateWith(new double[] { 1, 0 });
            Console.WriteLine("Outputs: ");
            foreach (var result in nn.Outputs)
            {
                Console.WriteLine(result);
            }
            Console.WriteLine("Actual: 1");

            nn.SimulateWith(new double[] { 1, 1 });
            Console.WriteLine("Outputs: ");
            foreach (var result in nn.Outputs)
            {
                Console.WriteLine(result);
            }
            Console.WriteLine("Actual: 0");
        }
    }
}
